package com.haiyou.dc.message.handler;

import com.haiyou.dc.message.util.SendMsgUtil;
import lombok.extern.slf4j.Slf4j;
import redis.clients.jedis.JedisPubSub;

/**
 * @author pc
 */
@Slf4j
public class MessageListener extends JedisPubSub {
    @Override
    public void onMessage(String channel, String message) {
        try {
            log.info("Redis channel:" + channel + ",message=" + message);
            SendMsgUtil.sendMsg(message);
        } catch (Throwable e) {
            log.error("MessageListener onMessage error", e);
        }

    }

    @Override
    public void onSubscribe(String channel, int subscribedChannels) {

    }

    @Override
    public void onUnsubscribe(String channel, int subscribedChannels) {

    }

    @Override
    public void onPSubscribe(String pattern, int subscribedChannels) {

    }

    @Override
    public void onPUnsubscribe(String pattern, int subscribedChannels) {

    }

    @Override
    public void onPMessage(String pattern, String channel, String message) {

    }
}
